package shejishiyan;
//成绩类
public class Score {
 private Student student;
 private Course course;
 private double score;
 
 public Score(Student student, Course course, double score) throws ScoreOutOfRangeException {
     this.student = student;
     this.course = course;
     setScore(score);
 }
 public void setScore(double score) throws ScoreOutOfRangeException {
     if (score < 0 || score > 100) {
         throw new ScoreOutOfRangeException("分数必须在0-100之间");
     }
     this.score = score;
 }
 // Getter方法
 public Student getStudent() { return student; }
 public Course getCourse() { return course; }
 public double getScore() { return score; }
 public String toString() {
     return student.getName() + "的" + course.getCourseName() + "成绩:" + score;
 }
}